package com.jiaai.cloud.wx.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.enums.IdType;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author 佳爱网络科技
 * @since 2017-09-22
 */
@TableName("t_wxshop")
public class TWxshop extends Model<TWxshop> {

    private static final long serialVersionUID = 1L;

    /**
     * 商店id
     */
	@TableId(value="shopid", type= IdType.AUTO)
	private Integer shopid;
    /**
     * 商店简介
     */
	private String introduce;
    /**
     * 商店联系电话
     */
	private String phonenumber;
    /**
     * 商店地理位置
     */
	private String geohash;
    /**
     * 商店名称
     */
	private String shopname;
    /**
     * 商店图片
     */
	@JSONField(serialize = false)
	private String shopavater;
    /**
     * 商店注册时间
     */
	@JSONField(format = "YYYY-MM-dd")
	private Date regdate;

    /**
     * 商店的详细地址
     */
	private String address;
	private String lat;
	private String lng;
    /**
     * 商品分类
     */
	private String shopclass;
    /**
     * 商店分类的id
     */
	private Integer sclassid;
    /**
     * 被浏览的次数
     */
	private Integer lookedtimes;
    /**
     * 是否空调开放
     */
	private Integer isairopen;
    /**
     * 是否wifi开放
     */
	private Integer iswifi;
    /**
     * 是否可以花呗
     */
	private Integer ishuabei;
    /**
     * 是否可信用卡
     */
	private Integer iscreditable;
    /**
     * 是否小额存储
     */
	private Integer islittleamount;
    /**
     * 是否超级商店
     */
	private Integer issupershop;
    /**
     * 是否可贷款
     */
	private Integer isloans;


	public Integer getShopid() {
		return shopid;
	}

	public void setShopid(Integer shopid) {
		this.shopid = shopid;
	}

	public String getIntroduce() {
		return introduce;
	}

	public void setIntroduce(String introduce) {
		this.introduce = introduce;
	}

	public String getPhonenumber() {
		return phonenumber;
	}

	public void setPhonenumber(String phonenumber) {
		this.phonenumber = phonenumber;
	}

	public String getGeohash() {
		return geohash;
	}

	public void setGeohash(String geohash) {
		this.geohash = geohash;
	}

	public String getShopname() {
		return shopname;
	}

	public void setShopname(String shopname) {
		this.shopname = shopname;
	}

	public String getShopavater() {
		return shopavater;
	}

	public void setShopavater(String shopavater) {
		this.shopavater = shopavater;
	}

	public Date getRegdate() {
		return regdate;
	}

	public void setRegdate(Date regdate) {
		this.regdate = regdate;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getLat() {
		return lat;
	}

	public void setLat(String lat) {
		this.lat = lat;
	}

	public String getLng() {
		return lng;
	}

	public void setLng(String lng) {
		this.lng = lng;
	}

	public String getShopclass() {
		return shopclass;
	}

	public void setShopclass(String shopclass) {
		this.shopclass = shopclass;
	}

	public Integer getSclassid() {
		return sclassid;
	}

	public void setSclassid(Integer sclassid) {
		this.sclassid = sclassid;
	}

	public Integer getLookedtimes() {
		return lookedtimes;
	}

	public void setLookedtimes(Integer lookedtimes) {
		this.lookedtimes = lookedtimes;
	}

	public Integer getIsairopen() {
		return isairopen;
	}

	public void setIsairopen(Integer isairopen) {
		this.isairopen = isairopen;
	}

	public Integer getIswifi() {
		return iswifi;
	}

	public void setIswifi(Integer iswifi) {
		this.iswifi = iswifi;
	}

	public Integer getIshuabei() {
		return ishuabei;
	}

	public void setIshuabei(Integer ishuabei) {
		this.ishuabei = ishuabei;
	}

	public Integer getIscreditable() {
		return iscreditable;
	}

	public void setIscreditable(Integer iscreditable) {
		this.iscreditable = iscreditable;
	}

	public Integer getIslittleamount() {
		return islittleamount;
	}

	public void setIslittleamount(Integer islittleamount) {
		this.islittleamount = islittleamount;
	}

	public Integer getIssupershop() {
		return issupershop;
	}

	public void setIssupershop(Integer issupershop) {
		this.issupershop = issupershop;
	}

	public Integer getIsloans() {
		return isloans;
	}

	public void setIsloans(Integer isloans) {
		this.isloans = isloans;
	}

	@Override
	protected Serializable pkVal() {
		return this.shopid;
	}

	public List<TWxgoods> getGoods() {
		return goods;
	}

	public void setGoods(List<TWxgoods> goods) {
		this.goods = goods;
	}

	/**
	 * 商店发布的商品
	 */
	@TableField(exist = false)
	private List<TWxgoods> goods;

	/**
	 * 商店与用户的距离
	 */
	@TableField(exist = false)
	private double distance;

	public double getDistance() {
		return distance;
	}

	public void setDistance(double distance) {
		this.distance = distance;
	}

	public List<String> getPiclist() {
		if(StringUtils.isEmpty(shopavater)){
			return this.piclist;
		}
		if( shopavater.indexOf(",") <= 0 ){
			this.piclist.add(this.shopavater);
			return this.piclist;
		}
		return Arrays.asList(this.shopavater.split(","));

	}

	public void setPiclist(List<String> piclist) {
		this.piclist = piclist;
	}

	/**
	 * 商店图片url数组
	 */
	@TableField(exist = false)
	private List<String> piclist=new ArrayList<>();

	@TableField(exist = false)
	private Integer userid;

	public Integer getUserid() {
		return userid;
	}

	public void setUserid(Integer userid) {
		this.userid = userid;
	}
}
